<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>离职证明模版</title>
    <link href="../css/all.min.css" rel="stylesheet">
    <style>
        body {
            background-color: #f4f4f5;
            font-family: "SimSun", sans-serif;
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            margin: 0;
        }

       .a4-container {
            width: 210mm;
            min-height: 297mm;
            padding: 32px;
            background-color: #fff;
            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
            border-radius: 8px;
            position: relative;
            box-sizing: border-box;
        }

       .title {
            font-size: 22px;
            font-weight: bold;
            text-align: center;
            color: #000;
            margin-bottom: 24px;
        }

       .content-text {
            color: #000;
            line-height: 1.75;
            margin-bottom: 16px;
            text-indent: 2em;
        }

       .print-button {
            position: fixed;
            top: 50%;
            right: 20px;
            transform: translateY(-50%);
            padding: 10px 20px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
        }

       .print-button:hover {
            background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
        }

       .signature-section {
            text-align: right;
            margin-top: 50px;
            display: flex;
            flex-direction: column;
            align-items: flex-end;
            position: relative;
        }

        @media print {
            body {
                background-color: transparent;
            }

           .a4-container {
                box-shadow: none;
                border-radius: 0;
                width: 210mm;
                min-height: 297mm;
                margin: 0;
                padding: 32px;
                page-break-after: avoid;
            }

           .print-button {
                display: none;
            }
        }

       .editable {
            border-bottom: 1px solid #000;
            outline: none;
            display: inline-block;
            text-indent: 0px;
        }

       .divider {
            border-top: 1px dotted #ccc;
            margin: 40px 0;
        }
    </style>
</head>

<body>
    <div class="a4-container">
        <h1 class="title">离职证明</h1>
        <p class="content-text">兹有 <span class="editable" contenteditable="true" data-default="请输入员工姓名">请输入员工姓名</span> ，性别： <span class="editable" contenteditable="true" data-default="请输入性别">请输入性别</span> ，身份证号码： <span class="editable" contenteditable="true" data-default="请输入身份证号">请输入身份证号</span> ，于 <span class="editable" contenteditable="true" data-default="请输入入职日期">请输入入职日期</span> 至 <span class="editable" contenteditable="true" data-default="请输入离职日期">请输入离职日期</span> 在我公司担任 <span class="editable" contenteditable="true" data-default="请输入工作岗位">请输入工作岗位</span> 职务。因 <span class="editable" contenteditable="true" data-default="请输入离职原因">请输入离职原因</span> 申请离职，现其与我公司之间的各项手续已经结清，劳动合同关系于 <span class="editable" contenteditable="true" data-default="请输入解除合同日期">请输入解除合同日期</span> 解除。</p>
        <p class="content-text">特此证明！</p>
        <div class="signature-section">
            <p class="content-text">单位盖章：<span id="signature-line" class="underline-text">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></p>
            <p class="content-text">日期：<span id="current-date1" class="editable" contenteditable="true" data-default="请输入签字日期">请输入签字日期</span></p>
        </div>
        <p class="content-text" style="font-style: italic;">&lt;公司留存&gt;</p>
        <p class="content-text">领取人：<span class="editable">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></p>
        <p class="content-text">日&nbsp;期：<span class="editable">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></p>

        <div class="divider"></div>

        <h1 class="title">离职证明</h1>
        <p class="content-text">兹有 <span class="editable" contenteditable="true" data-default="请输入员工姓名">请输入员工姓名</span> ，性别： <span class="editable" contenteditable="true" data-default="请输入性别">请输入性别</span> ，身份证号码： <span class="editable" contenteditable="true" data-default="请输入身份证号">请输入身份证号</span> ，于 <span class="editable" contenteditable="true" data-default="请输入入职日期">请输入入职日期</span> 至 <span class="editable" contenteditable="true" data-default="请输入离职日期">请输入离职日期</span> 在我公司担任 <span class="editable" contenteditable="true" data-default="请输入工作岗位">请输入工作岗位</span> 职务。因 <span class="editable" contenteditable="true" data-default="请输入离职原因">请输入离职原因</span> 申请离职，现其与我公司之间的各项手续已经结清，劳动合同关系于 <span class="editable" contenteditable="true" data-default="请输入解除合同日期">请输入解除合同日期</span> 解除。</p>
        <p class="content-text">特此证明！</p>
        <div class="signature-section">
            <p class="content-text">单位盖章：<span id="signature-line" class="underline-text">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></p>
            <p class="content-text">日期：<span id="current-date2" class="editable" contenteditable="true" data-default="请输入签字日期">请输入签字日期</span></p>
        </div>
        <p class="content-text" style="font-style: italic;">&lt;个人留存&gt;</p>
    </div>
    <button class="print-button" onclick="window.print()">打印</button>

    <script>
        const currentDate = new Date();
        const year = currentDate.getFullYear();
        const month = String(currentDate.getMonth() + 1).padStart(2, '0');
        const day = String(currentDate.getDate()).padStart(2, '0');
        document.getElementById('current-date1').textContent = `${year}年${month}月${day}日`;
        document.getElementById('current-date2').textContent = `${year}年${month}月${day}日`;

        const signatureLine = document.getElementById('signature-line');
        const editableElements = document.querySelectorAll('.editable');

        editableElements.forEach(element => {
            element.addEventListener('focus', function () {
                setTimeout(() => {
                    if (this.textContent === this.dataset.default) {
                        this.textContent = '';
                        this.style.color = '#000';
                    }
                }, 0);
            });

            element.addEventListener('blur', function () {
                if (this.textContent === '') {
                    this.textContent = this.dataset.default;
                    this.style.color = '#777';
                }
            });

            element.addEventListener('input', function () {
                const defaultValue = this.dataset.default;
                const allElementsWithSameDefault = document.querySelectorAll(`.editable[data-default="${defaultValue}"]`);
                allElementsWithSameDefault.forEach(el => {
                    if (el!== this) {
                        el.textContent = this.textContent;
                    }
                });
            });
        });
    </script>
</body>

</html>
    